<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8" import="com.java.service.*,java.util.*,com.java.model.UserSession,com.java.util.*,java.text.SimpleDateFormat"%>
<%
UserSession usersession = (UserSession)session.getAttribute("user");
String ent_id 			= (String)session.getAttribute("ent_id");

String uni_id = CmmUtil.nvl(request.getParameter("uni_id"),"");

System.out.println("uni_id======>"+uni_id);

String login_id = "";
String login_nm = "";
String login_pw = "";
String soc_no = "";
String soc_no1 = "";
String soc_no2 = "";
String birth_yy = "";
String birth_mm = "";
String birth_dd = "";
String solar_cal_gb = "";
String phone1 = "";
String phone2 = "";
String phone3 = "";
String c_phone1 = "";
String c_phone2 = "";
String c_phone3 = "";
String mail_id = "";
String mail_host = "";
String post1 = "";
String post2 = "";
String post_addr = "";
String detail_addr = "";
String dept_cd = "";
String class_cd = "";
String fin_school = "";
String sms_rcv_yn = "";
String service_end_dt = "";
String retire_yy = "";
String retire_mm = "";
String retire_dd = "";
String start_login_dt = "";

if(uni_id != null && !uni_id.equals("")){
	HashMap map_member = new HashMap();
	HashMap map1_member = null;
	ArrayList list_member = new ArrayList();
	CommonDaoService commonservice_member = new CommonDaoService("Com0101lp03SelectDao");
	map_member.put("uni_id",uni_id);
	map_member.put("ent_id",ent_id);	
	list_member = (ArrayList)commonservice_member.commonDaoMethod(map_member);
	
	login_id = CmmUtil.nvl((String)((HashMap)list_member.get(0)).get("login_id"),"");
	login_nm = CmmUtil.nvl((String)((HashMap)list_member.get(0)).get("login_nm"),"");
	login_pw = CmmUtil.nvl((String)((HashMap)list_member.get(0)).get("login_pw"),"");
	soc_no = CmmUtil.nvl((String)((HashMap)list_member.get(0)).get("soc_no"),"");
	birth_yy = CmmUtil.nvl((String)((HashMap)list_member.get(0)).get("birth_yy"),"");
	birth_mm = CmmUtil.nvl((String)((HashMap)list_member.get(0)).get("birth_mm"),"");
	birth_dd = CmmUtil.nvl((String)((HashMap)list_member.get(0)).get("birth_dd"),"");
	solar_cal_gb = CmmUtil.nvl((String)((HashMap)list_member.get(0)).get("solar_cal_gb"),"");
	phone1 = CmmUtil.nvl((String)((HashMap)list_member.get(0)).get("phone1"),"");
	phone2 = CmmUtil.nvl((String)((HashMap)list_member.get(0)).get("phone2"),"");
	phone3 = CmmUtil.nvl((String)((HashMap)list_member.get(0)).get("phone3"),"");
	c_phone1 = CmmUtil.nvl((String)((HashMap)list_member.get(0)).get("c_phone1"),"");
	c_phone2 = CmmUtil.nvl((String)((HashMap)list_member.get(0)).get("c_phone2"),"");
	c_phone3 = CmmUtil.nvl((String)((HashMap)list_member.get(0)).get("c_phone3"),"");
	mail_id = CmmUtil.nvl((String)((HashMap)list_member.get(0)).get("mail_id"),"");
	mail_host = CmmUtil.nvl((String)((HashMap)list_member.get(0)).get("mail_host"),"");
	post1 = CmmUtil.nvl((String)((HashMap)list_member.get(0)).get("post1"),"");
	post2 = CmmUtil.nvl((String)((HashMap)list_member.get(0)).get("post2"),"");
	post_addr = CmmUtil.nvl((String)((HashMap)list_member.get(0)).get("post_addr"),"");
	detail_addr = CmmUtil.nvl((String)((HashMap)list_member.get(0)).get("detail_addr"),"");
	dept_cd = CmmUtil.nvl((String)((HashMap)list_member.get(0)).get("dept_cd"),"");
	class_cd = CmmUtil.nvl((String)((HashMap)list_member.get(0)).get("class_cd"),"");
	fin_school = CmmUtil.nvl((String)((HashMap)list_member.get(0)).get("fin_school"),"");
	sms_rcv_yn = CmmUtil.nvl((String)((HashMap)list_member.get(0)).get("sms_rcv_yn"),"");
	service_end_dt = CmmUtil.nvl((String)((HashMap)list_member.get(0)).get("service_end_dt"),"");
	retire_yy = CmmUtil.nvl((String)((HashMap)list_member.get(0)).get("retire_yy"),"");
	retire_mm = CmmUtil.nvl((String)((HashMap)list_member.get(0)).get("retire_mm"),"");
	retire_dd = CmmUtil.nvl((String)((HashMap)list_member.get(0)).get("retire_dd"),"");
	start_login_dt = CmmUtil.nvl(CmmUtil.nvl((String)((HashMap)list_member.get(0)).get("start_login_dt"),""),"");
	
	login_id = Crypto.DecodeBySType(login_id);
	login_pw = Crypto.DecodeBySType(login_pw);
	soc_no = Crypto.DecodeBySType(soc_no);
	
	soc_no1 = soc_no.substring(0,6);
	soc_no2 = soc_no.substring(6,13);
}

String connGroup 	= "";
String user_id 		= "";
if(usersession!=null){
	connGroup 	= CmmUtil.nvl(usersession.getConnGroup(),"0");
	user_id 	= CmmUtil.nvl(usersession.getUser_id(),"");
}

System.out.println("connGroup======>"+connGroup);
System.out.println("user_id======>"+user_id);
System.out.println("ent_id======>"+ent_id);

java.util.Date date = new java.util.Date();
SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd");     
String today = formatter.format(date); 

HashMap map_1 = new HashMap();
HashMap map1_1 = null;
ArrayList list_1 = new ArrayList();
CommonDaoService commonservice_1 = new CommonDaoService("ComCodeListDao");
map_1.put("co_cd","010");
map_1.put("ent_id",ent_id);	
list_1 = (ArrayList)commonservice_1.commonDaoMethod(map_1);


HashMap map_2 = new HashMap();
HashMap map1_2 = null;
ArrayList list_2 = new ArrayList();
CommonDaoService commonservice_2 = new CommonDaoService("ComCodeListDao");
map_2.put("co_cd","011");
map_2.put("ent_id",ent_id);	
list_2 = (ArrayList)commonservice_2.commonDaoMethod(map_2);


HashMap map_3 = new HashMap();
HashMap map1_3 = null;
ArrayList list_3 = new ArrayList();
CommonDaoService commonservice_3 = new CommonDaoService("ComCodeListDao");
map_3.put("co_cd","020");
map_3.put("ent_id","");	
list_3 = (ArrayList)commonservice_3.commonDaoMethod(map_3);

%>
<jsp:include page="common/header.jsp"></jsp:include>

<script>
function f_soc_chk(){
	
	with(document.mainfrm)
	{
		if (login_nm.value == '' ){
			alert('성명을 입력하십시요.');
			login_nm.focus();
			return;
		}
		
		if (soc_no1.value.length != 6 ){
			alert('주민번호를 확인하세요.');
			soc_no1.focus();
			return;
		}

		if (soc_no2.value.length != 7 ){
			alert('주민번호를 확인하세요.');
			soc_no2.focus();
			return;
		}

		document.mainfrm.target = "ifm";
		document.mainfrm.method = "post";
		document.mainfrm.action = "/jsp/ifm/nc_p.jsp";
		document.mainfrm.submit();
	}
}

function f_id_chk(){
	
	with(document.mainfrm)
	{
		if (login_id.value == '' ){
			alert('아이디를 입력하십시요.');
			login_id.focus();
			return;
		}		

		document.mainfrm.target = "ifm";
		document.mainfrm.method = "post";
		document.mainfrm.action = "/jsp/ifm/id_chk.jsp";
		document.mainfrm.submit();
	}
}

function go_save(){
	with(document.mainfrm)
	{
		

		if (login_nm.value == '' ){
			alert('성명을 입력하십시요.');
			login_nm.focus();
			return;
		}
		
		if (soc_no1.value.length != 6 ){
			alert('주민번호를 확인하세요.');
			soc_no1.focus();
			return;
		}

		if (soc_no2.value.length != 7 ){
			alert('주민번호를 확인하세요.');
			soc_no2.focus();
			return;
		}

		if (login_id.value == '' ){
			alert('아이디를 입력하십시요.');
			login_id.focus();
			return;
		}

		if (id_chk.value == 'N' ){
			alert('아이디중복체크하세요');
			
			return;
		}

		if (login_pw.value == '' ){
			alert('비밀번호를 입력하십시요.');
			login_pw.focus();
			return;
		}

		if (login_pw.value != login_pw.value ){
			alert('비밀번호와 비밀번호확인이 일치하지 않습니다.');
			login_pw.focus();
			return;
		}

		if (cell_phone_no1.value == '' || cell_phone_no2.value == '' || cell_phone_no3.value == '' ){
			alert('핸드폰번호를 입력하십시요.');
			cell_phone_no1.focus();
			return;
		}
		

		document.mainfrm.target = "ifm";
		document.mainfrm.method = "post";
		document.mainfrm.action = "/jsp/com0101l_p04_update.jsp";
		document.mainfrm.submit();
	}
}

function go_modify(){
	with(document.mainfrm)
	{
		

		if (login_nm.value == '' ){
			alert('성명을 입력하십시요.');
			login_nm.focus();
			return;
		}
		
		if (soc_no1.value.length != 6 ){
			alert('주민번호를 확인하세요.');
			soc_no1.focus();
			return;
		}

		if (soc_no2.value.length != 7 ){
			alert('주민번호를 확인하세요.');
			soc_no2.focus();
			return;
		}

		if (login_id.value == '' ){
			alert('아이디를 입력하십시요.');
			login_id.focus();
			return;
		}		

		if (login_pw.value == '' ){
			alert('비밀번호를 입력하십시요.');
			login_pw.focus();
			return;
		}

		if (login_pw.value != login_pw.value ){
			alert('비밀번호와 비밀번호확인이 일치하지 않습니다.');
			login_pw.focus();
			return;
		}

		if (cell_phone_no1.value == '' || cell_phone_no2.value == '' || cell_phone_no3.value == '' ){
			alert('핸드폰번호를 입력하십시요.');
			cell_phone_no1.focus();
			return;
		}
		

		document.mainfrm.target = "ifm";
		document.mainfrm.method = "post";
		document.mainfrm.action = "/jsp/com0101l_p04_update.jsp";
		document.mainfrm.submit();
	}
}
</script>
<body>
<table width="992" border="0" cellpadding="0" cellspacing="0" align="center">
<form name="mainfrm" method="post">
<input type="hidden" id ="ent_id" name="ent_id" value="<%=ent_id %>">
<input type="hidden" id ="member_id" name="member_id" value="<%=uni_id %>">
<input type="hidden" id ="repl_id" name="repl_id" value="<%=user_id %>">
<input type="hidden" id ="repl_dt" name="repl_dt" value="<%=today %>">

<input type="hidden" id ="id_chk" name="id_chk" value="N">

  <tr>
    <td>
    <!--top -->
    <jsp:include page="common/top_menu.jsp"></jsp:include> 
    <!-- //top -->
    <!-- contents area -->
  <table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td width="180" valign="top">
		<jsp:include page="left/com0101l_p05.jsp"></jsp:include>
    </td>
    <td width="21" valign="top">&nbsp;</td>
    <td valign="top">
    	 <table width="790px"  border="0" cellpadding="0" cellspacing="0">
            <tr>
                <td style="font-size:14px; color:#3b70a2; font-weight:bold; border-bottom:2px solid #c8c8c8; padding:0 0 5px 0;" align="left"><img src="/images/sub_icon1.jpg"  alt="" border="0">&nbsp;회원관리</td>
             </tr>
        </table>
          <!-- 학생 회원가입 -->
        <table summary="학생 회원가입 상세정보입력" cellpadding="0" cellspacing="0" align="left">
            <tbody>
                <tr align="left">
                  <td class="MemberList_text">성명</td>
                  <td><input type="text" name="login_nm" class="w125" runat="server" maxlength="20" value="<%=login_nm %>"/></td>
                    <td class="MemberList_text">| 주민등록번호</td>
                    <td><input type="text" name="soc_no1" value="<%=soc_no1 %>" class="w125" runat="server"  maxlength="6"/>&nbsp;-&nbsp;<input type="password" name="soc_no2" value="<%=soc_no2 %>" class="w125" runat="server"  maxlength="7"/></td>
                    <td><input name="button" type="button" class="btn_gray_b_w47_1"  value="실명확인" onClick="f_soc_chk()"/></td>
                </tr>
                <tr>
                	<td colspan="5" style="padding:5px 0 5px 0;" align="left"><img src="/images/line_member.gif"  alt="" border="0"></td>
             	</tr>
                <tr align="left">

                    <td class="MemberList_text">아이디</td>
                    <td colspan="5"><input type="text" name="login_id" value="<%=login_id %>" class="w125" runat="server"  maxlength="20"/> 
					<%if(soc_no1.equals("")){ %><input name="button" type="button" class="btn_gray_b_w47_1"  value="아이디중복" onClick="f_id_chk()"/><%} %>
					</td>
                </tr>
                <tr>
                	<td colspan="5" style="padding:5px 0 5px 0;" align="left"><img src="/images/line_member.gif"  alt="" border="0"></td>
             	</tr>
                <tr align="left">
                    <td class="MemberList_text">비밀번호</td>
                    <td colspan="5"><input type="password" name="login_pw" value="<%=login_pw %>" class="w160" runat="server"  maxlength="20"/></td>
                </tr>
                 <tr>
                	<td colspan="5" style="padding:5px 0 5px 0;" align="left"><img src="/images/line_member.gif"  alt="" border="0"></td>
             	</tr>
                <tr align="left">
                    <td class="MemberList_text">비밀번호 확인</td>
                    <td colspan="5"><input type="password" name="login_pw2" value="<%=login_pw %>" class="w160" runat="server"  maxlength="20"/></td>
                </tr>
                  <tr>
                	<td colspan="5" style="padding:5px 0 5px 0;" align="left"><img src="/images/line_member.gif"  alt="" border="0"></td>
             	</tr>
                <tr align="left">
                    <td class="MemberList_text">소속부서</td>
                    <td colspan="5">
                        <select name="dept_cd">
						 <option value="">선택하세요</option>
					<% 
					String str_select = "";
					for(int i=0; i<list_1.size(); i++){
		            	map1_1 			= (HashMap)list_1.get(i); 
		            	
		            	if(map1_1.get("cd").equals(dept_cd)) str_select="selected";
		            	else str_select="";
		            %>
                         <option value="<%=map1_1.get("cd") %>" <%=str_select %>><%=map1_1.get("cd_nm") %></option>                         
					<%} %>
                       </select>                    </td>
                </tr>
                <tr>
                	<td colspan="5" style="padding:5px 0 5px 0;" align="left"><img src="/images/line_member.gif"  alt="" border="0"></td>
             	</tr>
                <tr align="left">
                    <td class="MemberList_text">직급</td>
                    <td colspan="5">
                        <select name="class_cd">
						 <option value="">선택하세요</option>
                    <% 
                    str_select = "";
                    for(int i=0; i<list_2.size(); i++){
		            	map1_2 			= (HashMap)list_2.get(i);   
		            	
		            	if(map1_2.get("cd").equals(class_cd)) str_select="selected";
		            	else str_select="";
		            %>
                         <option value="<%=map1_2.get("cd") %>" <%=str_select %>><%=map1_2.get("cd_nm") %></option>                         
					<%} %>
                       </select>                    </td>
                </tr>
                 <tr>
                	<td colspan="5" style="padding:5px 0 5px 0;" align="left"><img src="/images/line_member.gif"  alt="" border="0"></td>
             	</tr>
                 <tr align="left">
                    <td class="MemberList_text">생년월일</td>
                    <td>
                       <input type="text" name="birth_dt1" value="<%= birth_yy%>" class="w55" runat="server"   maxlength="4"/>년
                       <input type="text" name="birth_dt2" value="<%= birth_mm%>" class="w55" runat="server"   maxlength="2"/>월
                       <input type="text" name="birth_dt3" value="<%= birth_dd%>" class="w55" runat="server"  maxlength="2"/>일                    </td>
                    <td class="MemberList_text">| 구분</td>
                    <td colspan="2">
                        <input name="solar_cal_gb" type="radio" value="1"  <%=(solar_cal_gb.equals("1"))?"checked":"" %>/>
                        <label for="radio1">양력</label>
                        <input name="solar_cal_gb" type="radio" value="2" <%=(solar_cal_gb.equals("2"))?"checked":"" %>/>
                        <label for="radio1">음력</label>                    </td>
                </tr>
                  <tr>
                	<td colspan="5" style="padding:5px 0 5px 0;" align="left"><img src="/images/line_member.gif"  alt="" border="0"></td>
             	</tr>
                <tr align="left">
                	<td class="MemberList_text">전화번호</td>
                    <td colspan="5">
                      <input type="text" name="norm_phone_no1" value="<%= phone1%>" class="w55" runat="server"  maxlength="4"/>  
                      -
                      <input type="text" name="norm_phone_no2" value="<%= phone2%>" class="w55" runat="server"  maxlength="4"/>
                      -
                      <input type="text" name="norm_phone_no3" value="<%= phone3%>" class="w55" runat="server"  maxlength="4"/></td>
                </tr>
                 <tr>
                	<td colspan="5" style="padding:5px 0 5px 0;" align="left"><img src="/images/line_member.gif"  alt="" border="0"></td>
             	</tr>
                <tr align="left">
      				<td class="MemberList_text">핸드폰번호</td>
                    <td>
                      	<input type="text" name="cell_phone_no1" value="<%=c_phone1 %>" class="w55" runat="server"   maxlength="4"/>
                        -<input type="text" name="cell_phone_no2" value="<%=c_phone2 %>" class="w55" runat="server"   maxlength="4"/>
                        -<input type="text" name="cell_phone_no3" value="<%=c_phone3 %>" class="w55" runat="server"  maxlength="4"/>                    </td>
                    <td class="MemberList_text">| SMS 수신여부</td>
                    <td colspan="2">
                        <input name="sms_rcv_yn" type="radio" value="Y"  <%=(sms_rcv_yn.equals("Y"))?"checked":"" %>/>
                        <label for="radio2">사용</label>
                        <input name="sms_rcv_yn" type="radio" value="N" <%=(sms_rcv_yn.equals("N"))?"checked":"" %> />
                        <label for="radio2">미사용</label>&nbsp;&nbsp;(SMS학습독려차단)                    </td>
                </tr>
                 <tr>
                	<td colspan="5" style="padding:5px 0 5px 0;" align="left"><img src="/images/line_member.gif"  alt="" border="0"></td>
             	</tr>
                <tr align="left">
                     <td class="MemberList_text">이메일</td>
                      <td colspan="5" class="wCell2">
                        <input type="text" name="email_id1" value="<%=mail_id %>" class="w160" runat="server"  maxlength="50"/>
                            @
                          <input type="text" name="email_id2" value="<%=mail_host %>" class="w160" runat="server"  maxlength="50"/>                      </td>
                </tr>
                  <tr>
                	<td colspan="5" style="padding:5px 0 5px 0;" align="left"><img src="/images/line_member.gif"  alt="" border="0"></td>
             	</tr>
                <tr align="left">
                    <td rowspan="2" class="MemberList_text">주소</td>
                    <td colspan="4" style="padding:0 0 5px 0;">
                <input type="text" name="post_no1" value="<%=post1 %>" class="w55" runat="server"  maxlength="3" />-<input type="text" name="post_no2" value="<%=post2 %>" class="w55" runat="server"  maxlength="3" />                </tr>
                <tr align="left">
                    <td colspan="4">
                        <input type="text" name="post_addr" value="<%=post_addr %>" class="w495" runat="server"  /><br />
                        <input type="text" name="detail_addr" value="<%=detail_addr %>" class="w495" runat="server" id="txtAddr2" /></td>
                </tr>
                  <tr>
                	<td colspan="5" style="padding:5px 0 5px 0;" align="left"><img src="/images/line_member.gif"  alt="" border="0"></td>
             	</tr>
                 <tr align="left">
                    <td class="MemberList_text">최종학력</td>
                    <td colspan="4">
                        <select  name="fin_school" class="w130" runat="server">
						 <option value="">선택하세요</option>
                    <% 
                    str_select = "";
                    for(int i=0; i<list_3.size(); i++){
		            	map1_3 			= (HashMap)list_3.get(i);   
		            	
		            	if(map1_3.get("cd").equals(fin_school)) str_select="selected";
		            	else str_select="";
		            %>
                         <option value="<%=map1_3.get("cd") %>" <%=str_select %>><%=map1_3.get("cd_nm") %></option>                         
					<%} %>
                            </select>                     </td>
                  </tr>
                   <tr>
                	<td colspan="5" style="padding:5px 0 5px 0;" align="left"><img src="/images/line_member.gif"  alt="" border="0"></td>
             		</tr>
                   <tr align="left">
                    <td class="MemberList_text">퇴사일자</td>
                    <td>
 						<input type="text" name="retire_dt1" value="<%=retire_yy %>" class="w55" runat="server"  maxlength="4"/>년
                       <input type="text" name="retire_dt2" value="<%=retire_mm %>" class="w56" runat="server"  maxlength="2"/>월
                       <input type="text" name="retire_dt3" value="<%=retire_dd %>" class="w56" runat="server" maxlength="2"/>일                    </td>
                  </tr>
                   <tr>
                	<td colspan="5" style="padding:5px 0 5px 0;" align="left"><img src="/images/line_member.gif"  alt="" border="0"></td>
             		</tr>
                   <tr align="left">
                    <td class="MemberList_text">서비스종료일</td>
                    <td>
 						<input type="text" name="service_end_dt" value="<%=service_end_dt %>" class="w57" runat="server"  maxlength="15"/>                    </td>
                  </tr>
                   <tr>
                	<td colspan="5" style="padding:5px 0 5px 0;" align="left"><img src="/images/line_member.gif"  alt="" border="0"></td>
             		</tr>
                   <tr align="left">
                    <td class="MemberList_text" style="padding:0 0 5px 0;">첫 로그인</td>
                    <td style="padding:0 0 5px 0;" colspan="4">
 						<input type="text" name="start_login_dt" value="<%=start_login_dt %>" class="w57" runat="server"  maxlength="15"/>                    </td>
                  </tr>
                   <tr>
                	<td colspan="5" style="padding:5px 0 0 0;" align="left"><img src="/images/line_member.gif"  alt="" border="0"></td>
             		</tr>
                   <tr align="left">
                    <td colspan="5" align="right" style="padding:0 0 5px 0;">
					<%if(uni_id != null && !uni_id.equals("")){ %>
						<input name="Button" type="button" class="btn_blue_s_w71" id="button"  value="수정" onclick="go_modify()"/>
					<%}else{ %>
                   		<input name="Button" type="button" class="btn_blue_s_w71" id="button"  value="등록" onclick="go_save()"/>
					<%} %>										
                		<input name="button2" type="button" class="btn_pink_s_w71"  value="목록" onclick="history.back();"/>
                        </td>
                  </tr>
            </tbody>
        </table>
        <!-- //학생 회원가입 -->
    </td>
    </tr>
	</table>

   
    <table width="100%" border="0" cellpadding="0" cellspacing="0" style="border-top:2px solid #c8c8c8;" align="left">
    	<tr>
        	<td align="left"><img src="/images/copyright_hrd.gif"  alt="" border="0" /></td>
        </tr>
    </table>
	</td>
</form>
  </tr>
</table>

<iframe src="" name="ifm" width="0" height="0" frameborder="0"  framespacing="0" scrolling="no"></iframe>
</body>
</html>
